package com.shanzmoo.db.sys.entity.vo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shanzmoo.db.sys.entity.RoleEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 角色分页返回对象
 * @author: Gzhao 2020/11/12
 */
@Data
@ApiModel(value="RolePageVo", description="角色分页返回对象")
public class RolePageVo {

    @ApiModelProperty("角色ID" )
    private Integer roleId;

    @ApiModelProperty("角色名" )
    private String roleName;

    @ApiModelProperty("角色权限字符串" )
    private String roleKey;

    @ApiModelProperty("状态：1-启用，2-禁用" )
    private Boolean status;

    @ApiModelProperty("描述" )
    private String description;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("创建时间" )
    private LocalDateTime createTime;

    public static RolePageVo create(RoleEntity roleEntity) {
        return JSON.parseObject(JSON.toJSONString(roleEntity), RolePageVo.class);
    }
}
